//默认自动获取本地用户登录缓存
export default {
  state: {
    axiosSign: {},
    token: "",
    userId: "",
    userType: "",
    rule: 0,
		//商户信息
		merchantInfo:{},
		//图片展示
		showImg : true,
		//详情展示
		showInfo : false,
		//步骤条
		active : 1,
  },
  mutations: {
    setAxiosSign(state, obj) {
      state.axiosSign[obj.key] = obj.value;
    },
    setUserSign(state) {
	  if(window.localStorage.userInfo){
		  let info = JSON.parse(window.localStorage.userInfo);
		  state.token = info.token;
		  state.userId = info.userId;
		  state.userType = info.userType
		  state.rule = info.rule
	  }	

    },
    removeUserSign(state) {
      window.localStorage.removeItem("userInfo");
      //window.sessionStorage.removeItem("userInfo");
      state.token = "";
      state.userId = "";
      state.userType = "";
      state.role = "";
    },
		//商户详情
		merchant(state,info){
			state.merchantInfo = JSON.parse(info);
		},
		imgType(state,type){
			state.showImg = type;	//图片展示
		},
		infoType(state,type){
			state.showInfo = type;	//图片展示
		},
		activeType(state,type){
			state.active = type;	//图片展示
		}
  }
};
